@extends('admin.layout')
@section('title','订单列表')
@section('body')

    <div id="search" style="height:63px;">
        <blockquote class="layui-elem-quote" style="font-size: 14px">
            <form action="" method="post" class="layui-form">
                <div class="layui-form-item">
                    <div  class="layui-inline">
                        <label class="layui-form-label">搜索</label>
                        <div class="layui-input-inline">
                            <input type="tel" id="" name="keywords"  lay-verify="required" placeholder="请输入订单号" autocomplete="off" class="layui-input ">
                        </div>
                    </div>
                    {{csrf_field()}}
                    <div class="layui-inline">
                        <input  type="submit" class="layui-btn layui-btn-small" value="搜索">
                    </div>
                    <div class="layui-inline">
                        商品销售额{{$goods_sum}}元,成交订单{{$count}}笔，其中到店自提{{$receive_type1}}笔，邮寄{{$receive_type2}}笔。
                    </div>
                </div>
            </form>

        </blockquote>

    </div>
    <div id="search" style="height:63px;">
        <blockquote class="layui-elem-quote" style="font-size: 14px">
            <form action="" method="post" class="layui-form">
                <div class="layui-form-item">
                    <div  class="layui-inline">
                        <label class="layui-form-label">起始</label>
                        <div class="layui-input-inline">
                            <input type="date" id="" name="star"  lay-verify="required" placeholder="请选择起始时间" autocomplete="off" class="layui-input ">
                        </div>
                    </div>
                    {{csrf_field()}}
                    <div  class="layui-inline">
                        <label class="layui-form-label">结束</label>
                        <div class="layui-input-inline">
                            <input type="date" id="" name="end"  lay-verify="required" placeholder="请选择结束时间" autocomplete="off" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <input  type="submit" class="layui-btn layui-btn-small" value="筛选">
                    </div>
                </div>
            </form>

        </blockquote>

    </div>
    <table class="layui-table " >
        <colgroup>

        </colgroup>
        <thead>
        <tr>
            <th>单号</th>
            <th>用户</th>
            <th>总价</th>
            <th>抵扣</th>
            <th>返还积分</th>
            <th>运费</th>
            <th>创建时间</th>
            <th>状态</th>
            <th>取货类型</th>
        </tr>
        </thead>
        <tbody>
        @foreach($order as $value)
            <tr class="@if($value->order_status==2) bg-warning @elseif($value->order_status==3)bg-success  @elseif($value->order_status==4) bg-success@elseif($value->order_status==5) bg-success @endif">
                <td>{{$value->order_sn}}</td>
                <td>{{$value->my_user->phone}}</td>
                <td>{{$value->sum_price}}</td>
                <td>{{$value->use_integral}}元</td>
                <td>{{$value->back_integral}}点</td>
                <td>{{$value->freight}}元</td>
                <td>{{$value->created_at}}</td>
                <td>@if($value->order_status==2)未付款@elseif($value->order_status==3)已付款@elseif($value->order_status==4)已发货@elseif($value->order_status==5)已完成@endif</td>
                <td >
                  {{$value->receive_type==1?"到店自提":"邮寄"}}
                </td>
            </tr>
        @endforeach
        </tbody>
    </table>
    {!! $order->links() !!}
@endsection
@section('js')

    <script>
        @if(Session::has('message'))
             layer.msg("{{Session::get("message")}}");
        {{Session::forget('message')}}
        @endif
        function ins() {
            layer.open({
                title:"添加参数",
                content:'<form id="ins" method="post" enctype="multipart/form-data"><input type="text" class="layui-input" name="name" placeholder="一级分类名" /><br/>icon<input name="icon"  type="file"/> <input type="hidden" name="type" value="ins"></form>',
                yes:function () {
                    $("#ins").submit();
                }
            });
        }
        function edit(name,id) {
            layer.open({
                title:"修改参数",
                content:'<form id="edit" method="post"  enctype="multipart/form-data"  ><input type="text" class="layui-input" name="name" value="'+name+'" /><input type="hidden" name="class_id" value="'+id+'"><br/>icon<input name="icon"  type="file"/><input type="hidden" name="type" value="edit"></form>',
                yes:function () {
                    $("#edit").submit();
                }
            });
        }

        function goods_up(id) {
            layer.open({
                title:"提示",
                content:'确定上架吗？！<form id="up" method="post" action="{{url('/goods/up_down')}}"><input type="hidden" name="goods_id" value="'+id+'"><input type="hidden" name="type" value=1>{{csrf_field()}}</form>',
                yes:function () {
                    $("#up").submit();
                }
            })
        }

        function goods_down(id) {
            layer.open({
                title:"提示",
                content:'确定下架吗？！<form id="down" method="post" action="{{url('/goods/up_down')}}"><input type="hidden" name="goods_id" value="'+id+'"><input type="hidden" name="type" value=2>{{csrf_field()}}</form>',
                yes:function () {
                    $("#down").submit();
                }
            })
        }


    </script>

@endsection

